package it.javaweb.actions.utenti;

import it.javaweb.beans.Utente;
import it.javaweb.dao.UtenteDAO;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

public class ListaUtentiController implements Controller {
	
	private UtenteDAO utenteDao;
	
	public void setUtenteDao(UtenteDAO utenteDao) {
		this.utenteDao = utenteDao;
	}
	
	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
		
	List<Utente> lista = utenteDao.getAll();
		
		return new ModelAndView( "utenti/listaUtenti", "lista", lista );
	}

}
